package com.larly.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.larly.common.PageRequest;
import com.larly.model.domain.PrivateMessage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.larly.model.dto.privatemessage.PrivateMessageCreateRequest;
import com.larly.model.vo.PrivateMessageVO;

import java.util.List;

/**
* @author 许颢达
* @description 针对表【private_message(私信表)】的数据库操作Service
* @createDate 2025-09-02 12:31:02
*/
public interface PrivateMessageService extends IService<PrivateMessage> {

    /**
     * 创建私信
     * @param privateMessageCreateRequest
     * @return
     */
    boolean createPrivateMessage(PrivateMessageCreateRequest privateMessageCreateRequest,Integer senderId);

    /**
     * 分页查询历史记录（每天）
     */
    List<PrivateMessageVO> queryHistory(PageRequest pageRequest, Integer senderId, Integer receiverId);

    /**
     * 标记私信为已读
     */
    boolean readPrivateMessage(Integer senderId, Integer receiverId);

    /**
     * 展示最新消息列表
     */
    List<PrivateMessageVO> queryLatestList(Integer currentUserId);

    /**
     * 获取未读私信数
     */
    Long countUnreadByTarget(Integer currentUserId, Integer targetUserId);
}
